import '../../utils/concrete'

export function selectChargeUnits(query, formData) {
  const data = {
    condition: {
      unit_name: formData.roadName,
      unit_sfdw: formData.department_no,
      unit_park: formData.park_no,
      unit_status: formData.roadStatus,
      unit_roadkind: formData.isFan
    },
    num: query.page,
    pageSize: query.limit
  }
  return concrete.module('ChargeUnitManageService').selectChargeUnits(data)
}

export function selectBerthByParkno(query, paramData) {
  const data = {
    condition: {
      place_park: paramData
    },
    num: query.page,
    pageSize: query.limit
  }
  return concrete.module('ChargeUnitManageService').selectBerthByParkno(data)
}

export function selectBerthByChargeUnitNo(query, paramData) {
  const data = {
    condition: {
      place_chargeunit: paramData
    },
    num: query.page,
    pageSize: query.limit
  }
  return concrete.module('ChargeUnitManageService').selectBerthByChargeUnit(data)
}

export function addChargesUnit(paramData) {
  const data = {
    unit_no: paramData.chargeRoad_no,
    unit_name: paramData.chargeRoad_name,
    unit_park: paramData.park_no,
    unit_parkname: paramData.park_name,
    unit_sfdw: paramData.chargeUnit_no,
    unit_sfdwname: paramData.chargeUnit_name,
    unit_places: paramData.unit_places,
    unit_status: paramData.roadStatus
  }
  return concrete.module('ChargeUnitManageService').addChargesUnit(data)
}

export function updateChargesUnit(paramData) {
  const data = {
    unit_no: paramData.chargeRoad_no,
    unit_name: paramData.chargeRoad_name,
    unit_park: paramData.park_no,
    unit_parkname: paramData.park_name,
    unit_sfdw: paramData.chargeUnit_no,
    unit_sfdwname: paramData.chargeUnit_name,
    unit_places: paramData.unit_places,
    unit_status: paramData.roadStatus
  }
  return concrete.module('ChargeUnitManageService').updateChargesUnit(data)
}

export function deleteChargesUnit(paramData) {
  return concrete.module('ChargeUnitManageService').deleteChargesUnit(paramData)
}
